package com.pactera.demo.social.qq.connet;

import com.pactera.demo.social.qq.api.IQQ;
import com.pactera.demo.social.qq.api.QQUserInfo;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

/**
 * <p>
 *
 * </p>
 *
 * @author chang.zhou
 * @version version
 * @date Created in 2020/3/4 12:31
 */
public class QQAdapter implements ApiAdapter<IQQ> {

    @Override
    public boolean test(IQQ iqq) {
        return true;
    }

    @Override
    public void setConnectionValues(IQQ iqq, ConnectionValues values) {
        QQUserInfo userInfo = iqq.getUserInfo();
        values.setDisplayName(userInfo.getNickname());
        values.setImageUrl(userInfo.getFigureurl_qq_1());
        values.setProfileUrl(null);
        values.setProviderUserId(userInfo.getAppId());
    }

    @Override
    public UserProfile fetchUserProfile(IQQ iqq) {
        // do nothings
        return null;
    }

    @Override
    public void updateStatus(IQQ iqq, String s) {
        // do nothings
    }
}
